home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
3006
/
3006.xpi
/
chrome
/
dwhelper.jar
/
content
/
video-format.xml
< prev
next >
Wrap
Extensible Markup Language
|
2010-01-15
|
27KB
|
1,104 lines
<?xml version="1.0"?>
<!-- *****************************************************************************
* Copyright (c) 2006-2009 Michel Gutierrez. All Rights Reserved.
****************************************************************************** -->
<!DOCTYPE bindings SYSTEM "chrome://dwhelper/locale/dwhelper.dtd" >
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="VideoFormat" extends="widgets.xml#widget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tabbox flex="1">
<tabs>
<tab label="&title.video-format.general;"/>
<tab label="&title.video-format.advanced;"/>
</tabs>
<tabpanels flex="1">
<tabpanel flex="1">
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows anonid="xRows"/>
</grid>
<spacer flex="1"/>
</tabpanel>
<tabpanel flex="1">
<grid>
<columns>
<column/>
<column flex="1"/>
</columns>
<rows anonid="xRowsAdv"/>
</grid>
<spacer flex="1"/>
</tabpanel>
</tabpanels>
</tabbox>
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
this.paramToWidget={};
this.paramToFormat={};
this.paramWidgets=[];
this.hide2ndPassWidgets=[];
this.extraArgsWidget=null;
this.extensionWidget=null;
this.defaultExtensionWidget=null;
this.formats=[
{
args: ["f",1],
permanent: true,
defaultExtension: true,
hide2ndPass: true,
ilabel: "video-format.output-format",
type: "VideoFormatList",
config: [{value:'avi',label:'AVI format'},{value:'3g2',label:'3GP2 format'},{value:'3gp',label:'3GP format'},{value:'RoQ',label:'Id RoQ format'},{value:'ac3',label:'raw ac3'},{value:'adts',label:'ADTS AAC'},{value:'aiff',label:'Audio IFF'},{value:'alaw',label:'pcm A law format'},{value:'amr',label:'3gpp amr file format'},{value:'asf',label:'ASF format'},{value:'au',label:'SUN AU Format'},{value:'dv',label:'DV video format'},{value:'dvd',label:'MPEG2 PS format (DVD VOB)'},{value:'ffm',label:'FFM format'},{value:'flac',label:'raw flac'},{value:'flv',label:'FLV format'},{value:'gif',label:'GIF Animation'},{value:'gxf',label:'GXF format'},{value:'h261',label:'raw h261'},{value:'h263',label:'raw h263'},{value:'h264',label:'raw H264 video format'},{value:'m4v',label:'raw MPEG4 video format'},{value:'matroska',label:'Matroska File Format'},{value:'mjpeg',label:'MJPEG video'},{value:'mmf',label:'MMF format'},{value:'mov',label:'MOV format'},{value:'mp2',label:'MPEG audio layer 2'},{value:'mp3',label:'MPEG audio layer 3'},{value:'mp4',label:'MP4 format'},{value:'mpeg',label:'MPEG1 System format'},{value:'mpeg1video',label:'MPEG video'},{value:'mpeg2video',label:'MPEG2 video'},{value:'mpegts',label:'MPEG2 transport stream format'},{value:'mpjpeg',label:'Mime multipart JPEG format'},{value:'mulaw',label:'pcm mu law format'},{value:'nut',label:'NUT format'},{value:'ogg',label:'Ogg format'},{value:'psp',label:'psp mp4 format'},{value:'rawvideo',label:'raw video format'},{value:'rm',label:'RM format'},{value:'rtp',label:'RTP output format'},{value:'svcd',label:'MPEG2 PS format (VOB)'},{value:'swf',label:'Flash format'},{value:'vcd',label:'MPEG1 System format (VCD)'},{value:'vob',label:'MPEG2 PS format (VOB)'},{value:'voc',label:'Creative Voice File format'},{value:'wav',label:'WAV format'},]
},
{
extensionWidget: true,
hide2ndPass: true,
ilabel: "video-format.extension",
type: "VideoFormatText"
},
{
args: ["vcodec",1],
ilabel: "video-format.video-codec",
type: "VideoFormatList",
config: [{value: 'asv1'},{value: 'asv2'},{value: 'bmp'},{value: 'dnxhd'},{value: 'dvvideo'},{value: 'ffv1'},{value: 'ffvhuff'},{value: 'flashsv'},{value: 'flv'},{value: 'gif'},{value: 'h261'},{value: 'h263'},{value: 'h263p'},{value: 'huffyuv'},{value: 'jpegls'},{value: 'libtheora'},{value: 'libx264'},{value: 'libxvid'},{value: 'ljpeg'},{value: 'mjpeg'},{value: 'mpeg1video'},{value: 'mpeg2video'},{value: 'mpeg4'},{value: 'msmpeg4'},{value: 'msmpeg4v1'},{value: 'msmpeg4v2'},{value: 'pam'},{value: 'pbm'},{value: 'pgm'},{value: 'pgmyuv'},{value: 'png'},{value: 'ppm'},{value: 'qtrle'},{value: 'rawvideo'},{value: 'roqvideo'},{value: 'rv10'},{value: 'rv20'},{value: 'sgi'},{value: 'snow'},{value: 'svq1'},{value: 'targa'},{value: 'tiff'},{value: 'wmv1'},{value: 'wmv2'},{value: 'zlib'},{value: 'zmbv'}]
},
{
args: ["acodec",1],
ilabel: "video-format.audio-codec",
type: "VideoFormatList",
config: [{value:'ac3'},{value:'adpcm_adx'},{value:'adpcm_ima_wav'},{value:'adpcm_ms'},{value:'adpcm_swf'},{value:'adpcm_yamaha'},{value:'flac'},{value:'g726'},{value:'libamr_nb'},{value:'libamr_wb'},{value:'libfaac'},{value:'libgsm'},{value:'libgsm_ms'},{value:'libmp3lame'},{value:'libvorbis'},{value:'mp2'},{value:'pcm_alaw'},{value:'pcm_mulaw'},{value:'pcm_zork'},{value:'roq_dpcm'},{value:'sonic'},{value:'sonicls'},{value:'vorbis'},{value:'wmav1'},{value:'wmav2'}]
},
{
args: ["b",1],
ilabel: "video-format.bitrate",
type: "VideoFormatInteger",
},
{
args: ["sameq",0],
ilabel: "video-format.same-quality",
type: "VideoFormatBool",
},
{
args: ["r",1],
ilabel: "video-format.frame-rate",
type: "VideoFormatText",
},
{
args: ["s",1],
advanced: true,
ilabel: "video-format.frame-size",
type: "VideoFormatText",
},
{
args: ["ar",1],
advanced: true,
ilabel: "video-format.audio-freq",
type: "VideoFormatText",
},
{
args: ["target",1],
advanced: true,
ilabel: "video-format.target",
type: "VideoFormatList",
config: [{value:'pal-vcd'},{value:'pal-svcd'},{value:'pal-dvd'},{value:'pal-dv'},{value:'pal-dv50'},{value:'ntsc-vcd'},{value:'ntsc-svcd'},{value:'ntsc-dvd'},{value:'ntsc-dv'},{value:'ntsc-dv50'},{value:'film-vcd'},{value:'film-svcd'},{value:'film-dvd'},{value:'film-dv'},{value:'film-dv50'}]
},
{
args: ["aspect",1],
advanced: true,
ilabel: "video-format.aspect",
type: "VideoFormatList",
config: [{value:'4:3'},{value:'16:9'}]
},
{
args: ["qmin",1],
advanced: true,
ilabel: "video-format.qmin",
type: "VideoFormatText",
},
{
args: ["qmax",1],
advanced: true,
ilabel: "video-format.qmax",
type: "VideoFormatText",
},
{
args: ["vtag",1],
advanced: true,
ilabel: "video-format.vtag",
type: "VideoFormatText",
},
{
extraArgsWidget: true,
permanent: true,
advanced: true,
ilabel: "video-format.extra-args",
type: "VideoFormatText",
},
];
for(var i in this.formats) {
var format=this.formats[i];
var row=document.createElement("row");
row.setAttribute("align","center");
var label;
if(format.ilabel!=null) {
label=document.createElement("label");
label.setAttribute("value",DWHUtil.getText(format.ilabel));
} else if(format.label!=null) {
label=document.createElement("label");
label.setAttribute("value",format.label);
} else {
label=document.createElement("spacer");
}
row.appendChild(label);
var widget=document.createElement(format.type);
if(format.config) {
window.setTimeout(function(widget,config) {
widget.setConfig(config);
},0,widget,format.config);
}
if(format.permanent)
widget.setAttribute("permanent","true");
row.appendChild(widget);
if(format.args) {
this.paramToWidget[format.args[0]]=widget;
this.paramToFormat[format.args[0]]=format;
this.paramWidgets.push(widget);
}
if(format.extraArgsWidget)
this.extraArgsWidget=widget;
if(format.extensionWidget)
this.extensionWidget=widget;
if(format.defaultExtension)
this.defaultExtensionWidget=widget;
if(format.advanced)
this.xRowsAdv.appendChild(row);
else
this.xRows.appendChild(row);
if(format.hide2ndPass)
this.hide2ndPassWidgets.push(row);
}
]]>
</constructor>
<destructor>
<![CDATA[
]]>
</destructor>
<method name="secondPassMode">
<parameter name="sec"/>
<body>
<![CDATA[
for(var i=0;i<this.hide2ndPassWidgets.length;i++) {
this.hide2ndPassWidgets[i].setAttribute("hidden",""+sec);
}
]]>
</body>
</method>
<property name="value">
<setter>
<![CDATA[
for(var i=0;i<this.paramWidgets.length;i++) {
this.paramWidgets[i].value=null;
}
if(this.extraArgsWidget)
this.extraArgsWidget.value=null;
if(this.extensionWidget)
this.extensionWidget.value=null;
if(!/^[a-zA-Z0-9]*?\/.*$/.test(val))
val="wmv/-acodec wmav1 -b 1000kbps -f asf -vcodec wmv1";
var m=/^([a-zA-Z0-9]*?)\/(.*)/.exec(val);
var extension=m[1];
if(extension.length==0)
extension="avi";
var extraArgs="";
var v=m[2].replace(/ +/g," ");
v=/^ *(.*?) *$/.exec(v)[1];
var params=v.split(" ");
var cWidget=null;
var initial=true;
for(var i=0;i<params.length;i++) {
var arg=params[i];
if(initial) {
if(arg[0]=='-') {
cWidget=this.paramToWidget[arg.substr(1)];
if(cWidget) {
if(this.paramToFormat[arg.substr(1)].args[1]==0) {
cWidget.value=true;
} else {
initial=false;
}
} else {
extraArgs+=arg+" ";
}
} else {
extraArgs+=arg+" ";
}
} else {
cWidget.value=arg;
initial=true;
}
}
if(this.extraArgsWidget) {
this.extraArgsWidget.value=/^ *(.*?) *$/.exec(extraArgs)[1];
}
if(this.extensionWidget) {
if(this.defaultExtensionWidget) {
if(extension!=this.defaultExtensionWidget.value)
this.extensionWidget.value=extension;
else
this.extensionWidget.value=null;
} else {
this.extensionWidget.value=extension;
}
}
]]>
</setter>
<getter>
<![CDATA[
var extension=null;
if(this.extensionWidget)
extension=this.extensionWidget.value;
if(extension==null) {
if(this.defaultExtensionWidget)
extension=this.defaultExtensionWidget.value;
}
if(extension==null)
extension="avi";
var value=extension+"/";
var params=[];
for(var i in this.paramToFormat) {
var format=this.paramToFormat[i];
var widget=this.paramToWidget[i];
var wValue=widget.value;
if(format.args[1]==0) {
if(wValue==true)
params.push("-"+i);
} else {
if(wValue!=null && wValue.length>0) {
params.push("-"+i+" "+wValue);
}
}
}
if(this.extraArgsWidget) {
var wValue=/^ *(.*?) *$/.exec(this.extraArgsWidget.value)[1];
wValue=wValue.replace(/ +/g," ");
if(wValue.length>0) {
var eParams=wValue.split(" ");
for(var i=0;i<eParams.length;i++) {
if(eParams[i].length>0) {
if(eParams[i][0]=='-') {
params.push(eParams[i]);
} else if(params.length>0) {
params[params.length-1]+=" "+eParams[i];
}
}
}
}
}
if(params.length>0) {
params.sort();
value=value+params.join(" ");
}
return value;
]]>
</getter>
</property>
</implementation>
</binding>
<binding id="VideoFormatWidget" extends="widgets.xml#widget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
this.updateEnabled();
]]>
</constructor>
<destructor>
<![CDATA[
]]>
</destructor>
<method name="updateEnabled">
<body>
<![CDATA[
if(this.getAttribute("permanent")=="true") {
if(this.xEnabled) {
this.xEnabled.setAttribute("hidden","true");
}
if(this.xItem) {
this.xItem.setAttribute("hidden","false");
}
} else {
if(this.xEnabled) {
var enabled=this.xEnabled.value;
if(this.xItem) {
this.xItem.setAttribute("hidden",""+!enabled);
}
}
}
]]>
</body>
</method>
<method name="setConfig">
<parameter name="config"/>
<body>
<![CDATA[
]]>
</body>
</method>
<property name="value">
<setter>
<![CDATA[
if(this.xItem) {
if(this.xEnabled) {
if(val==null)
this.xEnabled.value=false;
else
this.xEnabled.value=true;
}
this.xItem.value=val;
this.updateEnabled();
}
]]>
</setter>
<getter>
<![CDATA[
if(this.getAttribute("permanent")!="true" && this.xEnabled && this.xEnabled.value==false)
return null;
if(this.xItem)
return /^ *(.*?) *$/.exec(this.xItem.value)[1];
else
return null;
]]>
</getter>
</property>
</implementation>
<handlers>
<handler event="vfenable">
<![CDATA[
this.updateEnabled();
]]>
</handler>
</handlers>
</binding>
<binding id="VideoFormatCheckbox" extends="widgets.xml#widget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox>
<spacer flex="1"/>
<html:input type="checkbox" anonid="xCheckbox"/>
<spacer flex="1"/>
</vbox>
<children style="display: none;"/>
</xbl:content>
<implementation>
<property name="value">
<setter>
<![CDATA[
if(this.xCheckbox)
this.xCheckbox.checked=(val==null)?false:val;
]]>
</setter>
<getter>
<![CDATA[
return this.xCheckbox?this.xCheckbox.checked:false;
]]>
</getter>
</property>
</implementation>
<handlers>
<handler event="change">
<![CDATA[
this.fireEvent("vfenable");
]]>
</handler>
</handlers>
</binding>
<binding id="VideoFormatList" extends="#VideoFormatWidget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hrow>
<VideoFormatCheckbox anonid="xEnabled"/>
<menulist anonid="xItem">
<menupopup anonid="xPopup"/>
</menulist>
</hrow>
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
]]>
</constructor>
<destructor>
<![CDATA[
]]>
</destructor>
<method name="setConfig">
<parameter name="config"/>
<body>
<![CDATA[
for(var i in config) {
var item=config[i];
var menuitem=document.createElement("menuitem");
var label;
if(item.ilabel) {
label=DWHUtil.getText(item.ilabel);
} else if(item.label) {
label=item.label;
} else {
label=item.value;
}
menuitem.setAttribute("label",label);
menuitem.setAttribute("value",item.value);
this.xPopup.appendChild(menuitem);
}
]]>
</body>
</method>
<property name="value">
<setter>
<![CDATA[
if(val==null)
this.xEnabled.value=false;
else
this.xEnabled.value=true;
this.xItem.selectedIndex=-1;
this.xItem.value=val;
this.updateEnabled();
]]>
</setter>
<getter>
<![CDATA[
if(this.getAttribute("permanent")!="true" && this.xEnabled && this.xEnabled.value==false)
return null;
if(this.xItem)
return /^ *(.*?) *$/.exec(this.xItem.value)[1];
else
return null;
]]>
</getter>
</property>
</implementation>
<handlers>
<handler event="DOMAttrModified">
<![CDATA[
if(event.attrName=="hidden") {
if(this.xItem.selectedIndex<0)
this.xItem.selectedIndex=0;
}
]]>
</handler>
</handlers>
</binding>
<binding id="VideoFormatText" extends="#VideoFormatWidget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hrow flex="1">
<VideoFormatCheckbox anonid="xEnabled"/>
<textbox anonid="xItem" flex="1"/>
</hrow>
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
]]>
</constructor>
<destructor>
<![CDATA[
]]>
</destructor>
</implementation>
</binding>
<binding id="VideoFormatInteger" extends="#VideoFormatText">
<implementation>
<constructor>
<![CDATA[
]]>
</constructor>
<destructor>
<![CDATA[
]]>
</destructor>
</implementation>
</binding>
<binding id="VideoFormatBool" extends="#VideoFormatWidget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<VideoFormatCheckbox anonid="xEnabled"/>
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
]]>
</constructor>
<destructor>
<![CDATA[
]]>
</destructor>
<property name="value">
<setter>
<![CDATA[
if(this.xEnabled)
this.xEnabled.value=val;
]]>
</setter>
<getter>
<![CDATA[
if(this.xEnabled)
return this.xEnabled.value;
return false;
]]>
</getter>
</property>
</implementation>
</binding>
<binding id="VideoFormatPanel" extends="widgets.xml#widget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox flex="1">
<FormatConfigList anonid="xList" flex="1"/>
<button
anonid="xShow"
label="&button.video-format.show-details;"
oncommand="this.parentNode.parentNode.showDetails()"/>
</hbox>
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
]]>
</constructor>
<method name="showDetails">
<body>
<![CDATA[
var data={
format: this.value
}
openDialog("chrome://dwhelper/content/video-format.xul","dwhelper-video-format","chrome,centerscreen,modal",data);
if(data.ok) {
this.value=data.format;
}
this.xList.updateFormat();
]]>
</body>
</method>
<property name="value">
<setter>
<![CDATA[
this.xList.value=val;
]]>
</setter>
<getter>
<![CDATA[
return this.xList.value;
]]>
</getter>
</property>
<method name="isValid">
<body>
<![CDATA[
var needReg=/(?: |\/)-f mp3(?: |$)/.test(this.value);
if(needReg==true) {
var props=this.convertMgr.getInfo();
var unregistered=props.get("unregistered",Components.interfaces.nsISupportsPRBool).data;
if(unregistered) {
this.util.alertWarning(this.util.getText("message.converter.need-registration"));
return false;
}
}
return true;
]]>
</body>
</method>
</implementation>
</binding>
<binding id="FormatConfigList" extends="widgets.xml#widget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox flex="1">
<menulist anonid="xList"
oncommand="this.parentNode.parentNode.itemSelected()" flex="1">
<menupopup anonid="xPopup"
datasources="rdf:null"
ref="http://downloadhelper.net/1.0#conv-confs">
<template>
<rule>
<menuitem
uri="rdf:*"
label="rdf:http://downloadhelper.net/1.0#label"
value="rdf:http://downloadhelper.net/1.0#value"
flex="1"
/>
</rule>
</template>
</menupopup>
</menulist>
<PopupButton anonid="xOps" hidden="true" image="chrome://dwhelper/skin/config.png">
<menuitem anonid="xNameBut"
label="&button.video-format.name;"
oncommand="setTimeout(function(_t){_t.nameConfig();},0,this.parentNode.parentNode.parentNode)"/>
<menuitem anonid="xRenameBut"
label="&button.video-format.rename;"
oncommand="setTimeout(function(_t){_t.renameConfig();},0,this.parentNode.parentNode.parentNode)"/>
<menuitem anonid="xForgetBut"
label="&button.video-format.forget;"
oncommand="setTimeout(function(_t){_t.forgetConfig();},0,this.parentNode.parentNode.parentNode)"/>
<menuseparator/>
<menuitem anonid="xDefaultBut"
label="&button.video-format.default;"
oncommand="setTimeout(function(_t){_t.setDefault();},0,this.parentNode.parentNode.parentNode)"/>
</PopupButton>
</hbox>
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
this.localstore=Components.classes["@mozilla.org/rdf/datasource;1?name=local-store"].
getService(Components.interfaces.nsIRDFDataSource);
this.util.setDatasource(this.xPopup,this.localstore);
if(this.getAttribute("confops")=="true")
this.xOps.setAttribute("hidden","false");
]]>
</constructor>
<destructor>
<![CDATA[
]]>
</destructor>
<method name="setDefaultConfigs">
<body>
<![CDATA[
this.convertMgr.setDefaultConfigs();
]]>
</body>
</method>
<method name="clearConfs">
<body>
<![CDATA[
this.convertMgr.clearConfigs(false);
]]>
</body>
</method>
<method name="updateFormat">
<body>
<![CDATA[
var label=null;
var confs=this.util.getChildResourcesS(this.localstore,this.NS+"conv-confs",{});
for(var i=0;i<confs.length;i++) {
if(this._value==this.util.getPropertyValueRS(this.localstore,confs[i],this.NS+"value")) {
label=this.util.getPropertyValueRS(this.localstore,confs[i],this.NS+"label");
this.namedFormatRes=confs[i];
break;
}
}
if(label==null) {
this.xNameBut.setAttribute("hidden","false");
this.xRenameBut.setAttribute("hidden","true");
this.xForgetBut.setAttribute("hidden","true");
this.namedFormatRes=null;
var ext="avi";
try {
ext=/^(.*?)\/.*$/.exec(this._value)[1];
} catch(e) {}
label=DWHUtil.getFText("label.video-format.custom",[ext.toUpperCase()],{});
} else {
this.xNameBut.setAttribute("hidden","true");
this.xRenameBut.setAttribute("hidden","false");
this.xForgetBut.setAttribute("hidden","false");
}
this.xList.setAttribute("label",label);
this.rebuild();
]]>
</body>
</method>
<method name="itemSelected">
<body>
<![CDATA[
this.value=this.xList.value;
setTimeout(function(_this) {
var evt = document.createEvent("Events");
evt.initEvent("dwhelper-confselect", true, true);
_this.dispatchEvent(evt);
},0,this);
]]>
</body>
</method>
<property name="value">
<setter>
<![CDATA[
this._value=val;
this.updateFormat();
]]>
</setter>
<getter>
<![CDATA[
return this._value;
]]>
</getter>
</property>
<method name="setDefault">
<body>
<![CDATA[
if(confirm(this.util.getText("confirm.video-format.back-to-default"))) {
this.clearConfs();
this.setDefaultConfigs();
this.updateFormat();
}
]]>
</body>
</method>
<method name="nameConfig">
<body>
<![CDATA[
if(this.namedFormatRes!=null)
return;
var name=prompt(this.util.getText("prompt.video-format.config-name"),"");
if(name!=null && name.length>0) {
var convConf=this.util.createNodeSS(this.localstore,this.NS+"conv-confs",null);
this.util.setPropertyValueRS(this.localstore,convConf,this.NS+"value",this.value);
this.util.setPropertyValueRS(this.localstore,convConf,this.NS+"label",name);
}
this.updateFormat();
]]>
</body>
</method>
<method name="renameConfig">
<body>
<![CDATA[
if(this.namedFormatRes==null)
return;
var name=prompt(this.util.getText("prompt.video-format.config-name"),
this.util.getPropertyValueRS(this.localstore,this.namedFormatRes,this.NS+"label"));
if(name!=null && name.length>0)
this.util.setPropertyValueRS(this.localstore,this.namedFormatRes,this.NS+"label",name);
this.updateFormat();
]]>
</body>
</method>
<method name="forgetConfig">
<body>
<![CDATA[
if(this.namedFormatRes==null)
return;
this.util.removeReference(this.localstore,this.namedFormatRes);
this.updateFormat();
]]>
</body>
</method>
<method name="rebuild">
<body>
<![CDATA[
this.xPopup.builder.rebuild();
]]>
</body>
</method>
</implementation>
</binding>
<binding id="VideoFormat2Passes" extends="widgets.xml#widget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox>
<VideoFormat anonid="xVFP"/>
<hbox>
<checkbox anonid="x2Passes"
label="&label.video-format.two-passes;"
oncommand="this.parentNode.parentNode.parentNode.changePassMode()"
/>
<spacer flex="1"/>
<menulist anonid="xPass"
hidden="true"
oncommand="this.parentNode.parentNode.parentNode.changePassNum()">
<menupopup>
<menuitem value="1" label="&label.video-format.first-pass;"/>
<menuitem value="2" label="&label.video-format.second-pass;"/>
</menupopup>
</menulist>
</hbox>
</vbox>
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
]]>
</constructor>
<method name="changePassMode">
<body>
<![CDATA[
this.xPass.value="1";
if(this.x2Passes.checked) {
var p=/.*?\/(.*)/.exec(this.xVFP.value)[1];
this._value=this.xVFP.value+"/"+p;
this.xPass.setAttribute("hidden","false");
} else {
var p=this._value;
if(/.*\/.*\/.*/.test(this._value))
p=/(.*?\/.*?)\/.*/.exec(this._value)[1];
this._value=p;
this.xPass.setAttribute("hidden","true");
}
]]>
</body>
</method>
<method name="changePassNum">
<body>
<![CDATA[
if(this.xPass.value=="2") {
var p1=this.xVFP.value;
var m=/(.*?)\/.*?\/(.*)/.exec(this._value);
this._value=p1+"/"+m[2];
this.xVFP.value=m[1]+"/"+m[2];
} else {
var p2=/.*?\/(.*)/.exec(this.xVFP.value)[1];
var p1=/(.*?\/.*?)\/.*/.exec(this._value)[1];
this._value=p1+"/"+p2;
this.xVFP.value=p1;
}
this.xVFP.secondPassMode(this.xPass.value=="2");
]]>
</body>
</method>
<property name="value">
<setter>
<![CDATA[
this._value=val;
var p=val.split("/");
if(p.length==2) {
this.x2Passes.checked=false;
this.xVFP.value=p[0]+"/"+p[1];
} else {
this.x2Passes.checked=true;
this.changePassNum();
}
this.changePassMode();
]]>
</setter>
<getter>
<![CDATA[
var value;
if(this.x2Passes.checked==false) {
value=this.xVFP.value;
} else {
if(this.xPass.value=="1") {
var p2=/.*\/.*\/(.*)/.exec(this._value)[1];
value=this.xVFP.value+"/"+p2;
} else {
var p1=/(.*?\/.*?)\/.*/.exec(this._value)[1];
value=p1+"/"+this.xVFP.value;
}
}
return value;
]]>
</getter>
</property>
</implementation>
</binding>
<binding id="NamedVideoFormat" extends="widgets.xml#widget">
<xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox>
<FormatConfigList anonid="xList" confops="true" flex="1"/>
<VideoFormat2Passes anonid="xFormat" oncommand="this.parentNode.parentNode.configChanged()" onchange="this.parentNode.parentNode.configChanged()"/>
</vbox>
<children style="display: none;"/>
</xbl:content>
<implementation>
<constructor>
<![CDATA[
]]>
</constructor>
<destructor>
<![CDATA[
]]>
</destructor>
<property name="value">
<setter>
<![CDATA[
this.xFormat.value=val;
this.xList.value=val;
]]>
</setter>
<getter>
<![CDATA[
return this.xFormat.value;
]]>
</getter>
</property>
<method name="configChanged">
<body>
<![CDATA[
if(this.changeTimeout!=null)
window.removeTimeout(this.changeTimeout);
this.changeTimeout=window.setTimeout(function(_t){_t.updateList();},250,this);
]]>
</body>
</method>
<method name="updateList">
<parameter name="param"/>
<body>
<![CDATA[
this.changeTimeout=null;
this.xList.value=this.value;
]]>
</body>
</method>
<method name="confSelected">
<body>
<![CDATA[
this.xFormat.value=this.xList.value;
]]>
</body>
</method>
</implementation>
<handlers>
<handler event="dwhelper-confselect">
<![CDATA[
this.confSelected();
]]>
</handler>
</handlers>
</binding>
</bindings>